<template>
  <el-dialog title='查看'
             v-if="open"
             :visible.sync="open"
             :modal= true
             append-to-body
             width="95%"
  >
  <div class="app-container">
    <el-form :model="form" size="small" :inline="true" label-width="120px">
      <el-row>
        <el-col :span="6">
          <el-form-item label="定标单编号:" prop="calibrationCode">
            <span>{{ form.calibrationCode }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="定标时间:" prop="calibrationTime">
            <span>{{ parseTime(form.calibrationTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="定标人:" prop="calibrationUser">
            <span>{{ form.calibrationUser }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="询价单编号:" prop="enquiryCode">
            <span>{{ form.enquiryCode }}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <div style="font-size: 21px;">定标明细</div>
            </el-col>
          </el-row>
          <el-table border :data="calibrationList"  max-height="600">
            <el-table-column label="物料编号" align="center" prop="itemCode"/>
            <el-table-column label="物料名称" align="center" prop="itemName"/>
            <el-table-column label="规格型号" align="center" prop="specification"/>
            <el-table-column label="单位" align="center" prop="unitOfMeasure"/>
            <el-table-column label="需求数量" align="center" prop="quantity"/>
            <el-table-column label="供应商" align="center" prop="vendorName" width="300"/>
            <el-table-column label="供货数量" align="center" prop="supplyQuantity"/>
            <el-table-column label="中标数量" align="center" prop="calibrateQuantity"/>
            <el-table-column label="含税单价" align="center" prop="taxPrice"/>
            <el-table-column label="税率" align="center" prop="tax"/>
            <el-table-column label="不含税单价" align="center" prop="noTaxPrice"/>
            <el-table-column label="含税金额" align="center" prop="taxAmount"/>
            <el-table-column label="不含税金额" align="center" prop="noTaxAmount"/>
            <el-table-column label="交货日期" align="center" prop="deliveryDate" width="200">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="含税金额：" prop="taxAmount">
            <span>{{form.taxAmount}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="不含税金额：" prop="noTaxAmount">
            <span>{{form.noTaxAmount}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer" style="text-align:center;margin-top: 20px;">
      <el-button type="info" @click="cancel">返 回</el-button>
    </div>
  </div>
  </el-dialog>
</template>

<script>
import {getCalibration} from "@/api/mes/cg/calibration";
export default {
  name: " CalibrationInfoView",
  data() {
    return {
      open:false,
      title:null,
      // 遮罩层
      loading: true,
      // 定标明细列表
      calibrationList: [],
      // 表单参数
      form: {},
    };
  },
  created() {
  },
  methods: {
    init(id){
      getCalibration(id).then(response => {
        this.form = response.data;
        this.calibrationList = response.data.cgPurchasePriceContrastList;
        this.open = true;
      })
    },
    // 取消按钮
    cancel() {
      this.open = false;
    }
  }
};
</script>
